﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="/themes/default/easyui.css" rel="stylesheet" />
    <link href="/themes/icon.css" rel="stylesheet" />
    <script src="/jquery-easyui-1.4.3/jquery.min.js"></script>
    <script src="/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
</head>
<body>
    <div id="tb">
        <table>
            <tr>
                <td>
                    <a id="btnAdd" href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-add'">新增</a>
                    <a id="btnAlter" href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-edit'">修改</a>
                    <a id="btnDelete" href="javascript:" class="easyui-linkbutton" data-options="iconCls:'icon-remove'">删除</a>
                    <br />
                    等级名称:
                    <input id="txtLelelName" style="width:80px" type="text" /><a id="btnSearcah" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a>
                </td>
            </tr>
        </table>
    </div>
    <table id="dg"></table>

    <div id="dlg" data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true">
        <iframe id="frm1" style="width:100%; height:99%;" scrolling="no" frameborder="0"></iframe>
    </div>






    <script type="text/javascript">
        $(function () {

            $('#dg').datagrid({
                fitColums: true,
                toolbar: "#tb",
                pagination: true,
                singleSelect: true,
                rownumbers:true,
                method:"get",
                url: '/jquery-easyui-1.4.3/demo/datagrid/datagrid_data1.json',
                columns: [[
                { field: 'productid', title: 'productid', width: 80 },
                { field: 'productname', title: 'productname', width: 120 },
               { field: 'listprice', title: 'listprice', width: 80,align:'right' },
                { field: 'unitcost', title: 'unitcost', width: 100,align:'right' },

                ]]
            });


            $("#btnAdd").click(function () {
                $("#dlg").dialog({ width: 500, height: 400 })
                .dialog("setTitle", "新增会员卡类别")
                .dialog("open");
                $("#frm1").attr("src", "09_AddVipSort.html")

            })

            $("#btnAlter").click(function () {
                var row=$("#dg").datagrid("getSelected");
                if(row!=null){
                $("#dlg").dialog({ width: 500, height: 400 })
                .dialog("setTitle", "修改会员卡类别")
                .dialog("open");
                $("#frm1").attr("src", "10_UpdateVipSort.html")
                }
                else
                {
                    $.messager.alert("提示","请选择要编辑的行","warning")
                }
            })

            $("#btnDelete").click(function ()
            {
                var row = $("#dg").datagrid("getSelected");
                if (row != null)
                {
                    $.messager.confirm('确认', '您确认想要删除记录吗？', function (r) {
                        if (r) {
                            alert('确认删除');
                        }
                    });

                }
                else
                {
                    $.messager.alert("提示", "请选择要删除的行", "warning");
                }

            })
        })

    </script>
</body>

</html>
